package when3meet.model;

import when3meet.view.KickUserButton;

/**
 * Model store here
 * 
 * @author Xi
 * 
 */
public class ClientInfo {

	public static ClientInfo ci;

	String userName;
	String password;
	String eventID;
	String choiceValue;
	String choiceIndex;
	String behavior;
	String type;
	String question;
	int numChoices;
	int numRounds;
	int position;
	String[] choices;
	int currentChoiceNum;
	int currentEdgeIndex = -1;
	String modName = null;
	String modPass = null;
	User[] users = null;
	Edge[] edges;
	Edge lastAddEdge;
	String key;
	KickUserButton[] kickBtn;

	public KickUserButton[] getKickBtn() {
		return kickBtn;
	}

	public void setKickBtn(KickUserButton[] kickBtn) {
		this.kickBtn = kickBtn;
	}

	public Edge[] getEdges() {
		return edges;
	}

	public void setEdges(Edge[] edges) {
		this.edges = edges;
	}

	public User[] getUsers() {
		return users;
	}

	public void setUsers(User[] users) {
		this.users = users;
	}

	public String getModName() {
		return modName;
	}

	public void setModName(String modName) {
		this.modName = modName;
	}

	public void setModPass(String modPass) {
		this.modPass = modPass;
	}

	public String getModPass() {
		return modPass;
	}

	/**
	 * judge whether a user is moderator or not
	 * 
	 * @return TRUE if he/she is moderator
	 * @return FALSE else
	 */
	public boolean isModerator() {
		boolean flag = false;
		if (modPass == null) {
			if (userName.equals(modName)) {
				flag = true;
			}
		} else if (userName.equals(modName) && password.equals(modPass)) {
			flag = true;
		}
		return flag;
	}

	/* getter and setter */

	public int getCurrentChoiceNum() {
		return currentChoiceNum;
	}

	public void setCurrentChoiceNum() {
		this.currentChoiceNum++;
	}

	public String[] getChoices() {
		return choices;
	}

	public void setChoices(String[] choices) {
		this.choices = choices;
	}

	public static ClientInfo getInstance() {
		if (ci == null)
			ci = new ClientInfo();
		return ci;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String p) {
		password = p;
		;
	}

	public String getEventID() {
		return eventID;
	}

	public void setEventID(String eventID) {
		this.eventID = eventID;
	}

	public String getBehavior() {
		return behavior;
	}

	public void setBehavior(String behavior) {
		this.behavior = behavior;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getQuestion() {
		return question;
	}

	public void setQuestion(String question) {
		this.question = question;
	}

	public int getNumChoices() {
		return numChoices;
	}

	public void setNumChoices(int numChoices) {
		this.numChoices = numChoices;
	}

	public int getNumRounds() {
		return numRounds;
	}

	public void setNumRounds(int numRounds) {
		this.numRounds = numRounds;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public void setLastAddEdge(Edge e) {
		lastAddEdge = e;
	}

	public Edge getLastAddEdge() {
		return lastAddEdge;
	}

	public void dispose() {
		ci = null;
	}

	public void setKey(String key) {
		this.key = key;

	}

	public String getKey() {
		return key;
	}

	public int getCurrentEdgeIndex() {
		return currentEdgeIndex;
	}

	public void setCurrentEdgeIndex(int currentEdgeIndex) {
		this.currentEdgeIndex = currentEdgeIndex;
	}

}
